@echo off

REM UTF-8
chcp 65001

setlocal EnableDelayedExpansion
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (
    set "dateStamp=%%c-%%a-%%b"
)
set "timeStamp=%TIME::=-%"

if exist 数据表格.xlsx (
	ren "数据表格.xlsx" "boss直聘_%dateStamp%_%timeStamp%.xlsx"
) else (
	echo "文件不存在"
)

xcopy /y boss直聘* boss_24hours_bot

xcopy /y file.bat boss_24hours_bot

REM 检查文件是否存在
if exist "boss直聘_%dateStamp%_%timeStamp%.xlsx" (
  REM 如果文件存在，则删除它
  del "boss直聘_%dateStamp%_%timeStamp%.xlsx"
  echo 文件已删除。
) else (
  echo 文件不存在。
)

cd boss_24hours_bot

REM 获取当前日期
set "datestr=%date%"
set "year=%datestr:~0,4%"
set "month=%datestr:~5,2%"
set "day=%datestr:~8,2%"

set  "dirname=boss直聘!year!!month!!day!"

if not exist "%dirname%" (
	md "%dirname%"

) else (
	echo "文件夹存在"
)

REM 遍历源文件夹中的所有 .xlsx 文件
for %%f in ("boss直聘*.xlsx") do (
  REM 将匹配到的文件移动到目标文件夹
  move "%%~ff" "%dirname%"
)



echo 移动完成

git add .

git commit -m "ADD_%dateStamp%_%timeStamp%"

git push

pause

